﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using 页面传递.BaseModel;
using 页面传递.Model;

namespace 页面传递
{
    public class HomePageViewModel : BaseProperty
    {
        public ResourceDictionary Resource
        {
            get;
            private set;
        } = ViewManager.Instance.Resource;

        private int GetComboxSelectIndex;
        public int ComboxSelectIndex
        {
            get => GetComboxSelectIndex;
            set
            {
                GetComboxSelectIndex = value;
                OnPropertyChanged();
                SetViewData(value);
            }
        }

        private FrameworkElement GetFramework;

        public FrameworkElement Window
        {
            get { return GetFramework; }
            set
            {
                GetFramework = value;
                Set();
            }
        }

        private object GetContent;

        public object ContentModel
        {
            get { return GetContent; }
            set { GetContent = value; OnPropertyChanged(); }
        }


        private void Set()
        {
            Window.Resources = Resource;
        }
        private void SetViewData(int index)
        {
            ContentModel = ViewManager.Instance.ViewContent[index];
        }
        public HomePageViewModel()
        {
            ViewManager.Instance.SetView(new ViewPage1(typeof(TestUserControl1), "测试页1"));
            ViewManager.Instance.SetView(new ViewPage2(typeof(TestUserControl2), "测试页2"));
            SetViewData(0);
        }

    }
}
